package org.summer.petstalk.main.adapter;

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

/**
 * Author:maybe1997
 * Date:2017/6/4
 * Version:v1.0
 * Note:
 */

public class AdapterGuideViewPager extends PagerAdapter {

    private Context mContext;
    private List<View> mViewList;

    public AdapterGuideViewPager(Context context,List<View> viewList){
        this.mContext=context;
        this.mViewList=viewList;
    }

    @Override
    public int getCount() {
        return mViewList.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return (view==object);
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView(mViewList.get(position));
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        container.addView(mViewList.get(position));
        return mViewList.get(position);
    }
}
